package com.filter;

import javax.servlet.*;
import java.io.IOException;

/**
 * @author wzm
 * @create 2023-05-13 16:15
 */
//@WebFilter("/*")
public class Filter01 implements Filter {
    //初始化
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {

    }

    /*做过滤器功能*/
    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        System.out.println("我是Filter我做了一些事情");

        //通常在这里对请求和响应做一些操作或判断

        //处理完后可以放行

        System.out.println("放行前");

        chain.doFilter(request,response);

        System.out.println("放行后");


    }

    /*销毁*/
    @Override
    public void destroy() {

    }
}
